package ztttt1;

public class Card implements Comparable<Card> {
    public String color;
    public String num;

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public String getNum() {
        return num;
    }

    public void setNum(String num) {
        this.num = num;
    }

    public Card(String color, String num) {
        this.color = color;
        this.num = num;
    }

    @Override
    public String toString() {
        return num+color;
    }

    @Override
    public int compareTo(Card o) {
        int num1 = 0;
        int num2 = 0;
        switch(o.getNum()){
            case "J":  num1 = 11; break;
            case "Q":  num1 = 12; break;
            case "K":  num1 = 13; break;
            case "A":  num1 = 14; break;
            default: num1 = Integer.valueOf(o.getNum());
        }
        switch(this.getNum()){
            case "J":  num2 = 11; break;
            case "Q":  num2 = 12; break;
            case "K":  num2 = 13; break;
            case "A":  num2 = 14; break;
            default: num2 = Integer.valueOf(this.getNum());
        }
        return num2 - num1;
    }
}
